/*
*********************************
	SF2D Game Engine
*********************************

	By Julian Williams
	June 11, 2010
**********************************

	Description:

		Some C Functions to help
	me with various things throught
	the engine.
***********************************
*/
#include <iostream>
#include "helper.h"




/* Super Fast Square Root */
float sqrtFast(float number) 
{
    long i;
    float x, y;
    const float f = 1.5F;

    x = number * 0.5F;
    y  = number;
    i  = * ( long * ) &y;
    i  = 0x5f3759df - ( i >> 1 ); //lolwut
    y  = * ( float * ) &i;
    y  = y * ( f - ( x * y * y ) );
    y  = y * ( f - ( x * y * y ) );
    
    return number * y;
}//EoF

